package com.zhongke.cotrun.common.payUtil;

import java.io.BufferedReader; 
import java.io.IOException;   
import java.io.InputStreamReader;   
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;      

    
public class Do_http_request{   
	  
	  public String do_get(String strURL, String param) {  
	        
	        try {  
	            URL url = new URL(strURL);// 创建连接
	            
	            HttpURLConnection con = (HttpURLConnection) url  
	                    .openConnection();  
	            
	            con.setDoOutput(true);  
	            con.setRequestMethod("GET");	           
	          
	            OutputStreamWriter out = new OutputStreamWriter(con  
	                    .getOutputStream());   
	           
	            out.write(new String(param.getBytes("UTF-8")));  
	            out.flush();  
	            out.close();  
	            
	            BufferedReader br = new BufferedReader(new InputStreamReader(con  
	                    .getInputStream(),"UTF-8"));  
	           
	            String str = null;
	            StringBuffer buffer = new StringBuffer();
	            while ((str = br.readLine()) != null) {
	                buffer.append(str).append("\n");
	            }
	            return buffer.toString().trim();
	            
	        } catch (IOException e) {  
	            return null;
	        }  
	   }
}  